// 门禁管理
import {
    ajaxPostBack,
    ajaxPost
} from '@/utils/data/request'

// 管理所有列表
export function managedoor(params: any) {
    return ajaxPostBack("device/manage-door-list", params, {})
}

// 管理编辑
export function manageedit(params: any) {
    return ajaxPost("device/manage-door-edit", params, { successMessage: true })
}

// 管理新增
export function manageadd(params: any) {
    return ajaxPost("device/manage-door-create", params, { successMessage: true })
}

// 管理设置
export function manageset(params: any) {
    return ajaxPost("device/manage-door-set", params, { successMessage: true })
}

// 管理删除
export function manageDelete({ door_sn }: any) {
    return ajaxPost("device/manage-door-delete", { door_sn }, { successMessage: true })
}

// 列表
export function list(params: any) {
    return ajaxPostBack("device/door-list", params, {
        cookies: ['yard_sn']
    })
}

// 通行门禁
export function passDoor() {
    return ajaxPostBack("device/door-list", { door_space: 1, page: 1, per_page: 100 }, {
        cookies: ['yard_sn']
    })
}


// 运营门禁
export function operateDoor() {
    return ajaxPostBack("device/door-list", { door_space: 2, page: 1, per_page: 100 }, {
        cookies: ['yard_sn']
    })
}



// 编辑
export function edit({ door_sn, door_name, group_sn, door_direct }: any) {
    return ajaxPost("device/door-edit", { door_sn, door_name, group_sn, door_direct }, { successMessage: true, cookies: ['yard_sn'] })
}

// 新增
export function add(params: any) {
    return ajaxPost("device/door-create", params, { successMessage: true, cookies: ['yard_sn'] })
}

// 删除
export function del({ door_sn, build_sn }: any) {
    return ajaxPost("device/door-delete", { door_sn, build_sn }, { successMessage: true, cookies: ['yard_sn'] })
}

// 开门记录
export function log(params: any) {
    return ajaxPost("device/door-log-list", params, { cookies: ['yard_sn'] })
}

// 访客邀约记录
export function vistor(params: any) {
    return ajaxPost("device/vistor-list", params, { cookies: ['yard_sn'] })
}

// 远程操作
export function remote(params: any) {
    return ajaxPost("device/door-remote", params, { successMessage: true })
}

export function confQr(params: any) {
    return ajaxPost("device/door-conf-qr", params, { errorMessage: false, cookies: ['yard_sn'] })
}

// 不同门禁厂商支持的门禁指令
export function cmdList(params: any) {
    return ajaxPost("device/door-cmd-list", params)
}


